<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>toggle</title>
</head>
<body>
<div id="div">我是div</div>
</body>
<script src="js/jquery-3.3.1.min.js"></script>
<!--插件的引入，必须放在主js文件下-->
<script src="js/jquery-migrate-1.2.1.js"></script>
<script>
    $("#div").toggle(function(){
        $(this).css("background","red");
    },function(){
        $(this).css("background","blue");
    },function(){
        $(this).css("background","yellow");
    });
</script>
</html>